9、ORB_SLAM2_Octomap

octomap official website:http://octomap.github.io/

octomap source code:https://github.com/OctoMap/octomap

octomap wiki:http://wiki.ros.org/octomap

octomap_server:http://wiki.ros.org/octomap_server

9.1 Introduction

Octomap uses the octree data structure to store the probabilistic occupancy map of the three-dimensional environment. OctoMap library implements a 3D occupancy grid mapping method, providing data structures and mapping algorithms in C++, which is particularly suitable for robots. The map implementation is based on octree.

It elegantly compresses and updates maps with adjustable resolution! It stores maps in the form of octotree (will be discussed later), which can save a lot of space compared to point clouds. The map created by octomap probably looks like this: (different resolutions from left to right)

img

Note: When building a map, moving the robot slowly and losing key frames may cause the map building to fail.

According to different models, you only need to set the purchased model in [.bashrc], X1 (normal four-wheel drive) X3 (Mailun) Take X3 as an example

Open the [.bashrc] file

Find the [ROBOT_TYPE] parameters and modify the corresponding car model

9.2. Use

Start orb_slam and the underlying driver (Robot side)

image-20220228194043475

Start octree mapping (Robot side)

Turn on the visual interface (virtual machine side)

image-20220228180936003

Due to the octree, its map looks like it is composed of many small squares (much like Minecraft). When the resolution is high, the squares are small; when the resolution is low, the squares are large. Each square represents the probability of that square being occupied.

9.3、octomap_server

9.3.1. Topics and services

Subscribe to topicstypedescription
cloud_insensor_msgs/PointCloud2Incoming 3D point cloud for scan integration.
Post a topictypedescription
octomap_binaryoctomap_msgs/OctomapThe complete maximum likelihood occupancy map is a compact octal-mapped binary stream encoding free space and occupied space. Binary messages only differentiate between free space and occupied space, but smaller.
octomap_fulloctomap_msgs/OctomapThe complete maximum likelihood occupancy map is a compact octal-mapped binary stream encoding free space and occupied space. The complete message contains the complete probabilities and all additional data stored in the tree.
occupied_cells_vis_arrayvisualization_msgs/MarkerArrayIn RViz, all occupied voxels are marked as visual "boxes"
octomap_point_cloud_centerssensor_msgs/PointCloud2The center of all occupied voxels serves as a point cloud and is useful for visualization. Note that this will have gaps because points have no volume size and octagonal voxels can have different resolutions!
mapnav_msgs/OccupancyGridProject the 2D occupation map downward from the 3D map.
Servicetypedescription
octomap_binaryoctomap_msgs/GetOctomapThe complete maximum likelihood occupancy map is a compact octal-mapped binary stream encoding free space and occupied space.
clear_bbxoctomap_msgs/BoundingBoxQueryClears an area in the 3D occupancy map, setting all voxels in that area to "Free"
resetstd_srvs/EmptyReset the entire map

Node view

1093

9.3.2. Configuration parameters

parameterstypedefaultdescription
frame_idstring/mapThe static global frame in which the map will be published. When building a map dynamically, sensor data needs to be converted to this frame.
resolutionfloat0.05The resolution of the map in meters when starting with an empty map. Otherwise the resolution of the loaded file will be used.
base_frame_idstringbase_footprintRobot base that performs ground plane detection (if enabled)
height_mapbooltrueWhether the visualization should encode the height with different colors
color/[r/g/b/a]float When ~heigh_map=False, display the color of occupied cells in the range [0:1]
sensor_model/max_rangefloat-1 (unlimited)The maximum extent (in meters) to interpolate point cloud data when building a map dynamically. Limiting the range to a useful range (e.g. 5 meters) prevents false error points away from the robot.
sensor_model/[hit|miss]float0.7 / 0.4Hit and miss probabilities in sensor models when building maps dynamically
sensor_model/[min|max]float0.12 / 0.97Minimum and maximum probabilities of clamping when building a map dynamically
latchboolTrue for static mapping, false if no initial mapping is givenWhether the topic is locked for publishing or published only once per change. For best performance when building maps (which update frequently), set this to false. When set to true, all topics and visualizations will be created on all changes on each map.
filter_groundboolfalseWhether the ground plane should be detected and ignored from scan data when building a map dynamically using pcl::SACMODEL_vertical_plane. This clears everything on the ground, but does not insert the ground into the map as an obstacle. If this feature is enabled, the ~ground_filter/... parameters can be further configured.
ground_filter/distancefloat0.04The distance threshold of the point to be segmented to the ground plane (z direction)
ground_filter/anglefloat0.15The angle threshold between the detected plane and the horizontal plane detected as the ground
ground_filter/plane_distancefloat0.07For a plane to be detected as ground, the distance threshold from z=0 (the fourth coefficient of the PCL plane equation)
pointcloud[min|max]zfloat-/+ infinityInsert in the callback the minimum and maximum height to be considered.
occupancy[min|max]zfloat-/+ infinityMinimum and maximum height to consider in the final map.

9.3.3.TF transformation

Required TF transformationdescription
sensor data frame --> /mapIf you do scan integration, you need to convert the sensor data into a global map frame. This information needs to be obtained from external SLAM or localization nodes.

View tf tree

1094